Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
keyboardevent-key-polyfill
Advanced tools
Polyfill for KeyboardEvent.prototype.key
.
NOTE: All major browsers now support
KeyboardEvent.prototype.key
. Firefox already shipped with this for a while; recent versions of Edge, Chrome, and Safari also now have shipped support. This will still enableKeyboardEvent.prototype.key
in environments where it may not yet be available.
Say goodbye to this:
document.addEventListener('keydown', function (e) {
console.log('Code of key pressed:', e.which || e.keyCode); // 39
});
And hello to this:
document.addEventListener('keydown', function (e) {
console.log('Name of key pressed:', e.key); // ArrowRight
});
Just drop the script on your page and call the polyfill
method.
<script src="index.js"></script>
<script>keyboardeventKeyPolyfill.polyfill();</script>
If you're using AMD:
require('keyboardevent-key-polyfill').polyfill();
Install from npm:
npm install keyboardevent-key-polyfill
Then require the CommonJS module for use with Browserify/webpack:
require('keyboardevent-key-polyfill').polyfill();
All code and content within this source-code repository is licensed under the Creative Commons Zero v1.0 Universal license (CC0 1.0 Universal; Public Domain Dedication).
You can copy, modify, distribute and perform this work, even for commercial purposes, all without asking permission.
For more information, refer to these following links:
FAQs
polyfill for `KeyboardEvent.prototype.key`
The npm package keyboardevent-key-polyfill receives a total of 45,827 weekly downloads. As such, keyboardevent-key-polyfill popularity was classified as popular.
We found that keyboardevent-key-polyfill demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.